#include "CFDPostOperatorsViewAngle.h"
#include "GUIFrame/MainWindow.h"

#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Component/FITKRenderWindowVTK/FITKGraph3DWindowVTK.h"

#include "OperatorsInterface/GraphEventOperator.h"

namespace OperModel
{

CFDPostOperatorsViewAngle::CFDPostOperatorsViewAngle()
{

}

CFDPostOperatorsViewAngle::~CFDPostOperatorsViewAngle()
{

}

bool CFDPostOperatorsViewAngle::execGUI()
{
    /*GUI::MainWindow* mainWin = dynamic_cast<GUI::MainWindow*>(FITKAPP->getGlobalData()->getMainWindow());
    if (mainWin == nullptr)
    {
        return false;
    }*/
    EventOper::GraphEventOperator* graphOper = FITKOPERREPO->getOperatorT<EventOper::GraphEventOperator>("GraphPreprocess");
    auto graphWidget = dynamic_cast<Comp::FITKGraph3DWindowVTK*>(graphOper->getGraphWidget());

    if(graphWidget==nullptr)
    {
        return false;
    }

    if(_senderName == "actionViewAuto")
    {
        graphWidget->slotActionViewPanEvent();
    }
    else if(_senderName =="actionViewFront")
    {
        graphWidget->slotActionViewFrontEvent();
    }
    else if(_senderName =="actionViewBack")
    {
        graphWidget->slotActionViewBackEvent();
    }
    else if(_senderName =="actionViewTop")
    {
        graphWidget->slotActionViewTopEvent();
    }
    else if(_senderName =="actionViewBottom")
    {
        graphWidget->slotActionViewBottomEvent();
    }
    else if(_senderName == "actionViewLeft")
    {
        graphWidget->slotActionViewLeftEvent();
    }
    else if(_senderName =="actionViewRight")
    {
        graphWidget->slotActionViewRightEvent();
    }
    else if(_senderName =="actionViewIso")
    {
        graphWidget->slotActionViewIsoEvent();
    }
    return true;
}

}
